package org.suwenqian.airoleplayingchatbackend.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.suwenqian.airoleplayingchatbackend.dao.dto.req.VoiceChatReqDTO;
import org.suwenqian.airoleplayingchatbackend.service.VoiceChatService;

import java.io.IOException;
import java.util.concurrent.CompletableFuture;

@RestController
@RequiredArgsConstructor
@RequestMapping("/ai-role-play/chat")
public class VoiceChatController {

    private final VoiceChatService voiceChatService;

    /**
     * 语音聊天接口
     * @param requestParm 请求参数
     * @return 返回语音文件
     */
    @PostMapping("/voiceChat")
    public CompletableFuture<ResponseEntity<Resource>> voiceChat(@RequestBody VoiceChatReqDTO requestParm) throws IOException {
        return voiceChatService.voiceChat(requestParm);
    }

}